package com.cskaoyan.controller;

import com.cskaoyan.bean.vo.BaseRespVo;
import com.cskaoyan.bean.vo.ZbUserDataVo;
import com.cskaoyan.bean.vo.ZbUserIndexVo;
import com.cskaoyan.mapper.CskaoyanmallUserMapper;
import com.cskaoyan.service.ZbUserService;
import com.cskaoyan.utils.QueryUserIdByUserNameUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/wx/user")
public class ZbWXUserController {
    @Autowired
    ZbUserService zbUserService;

    @Autowired
    CskaoyanmallUserMapper userMapper;

@GetMapping("/index")
    public Object index(){

    Integer userId = QueryUserIdByUserNameUtils.queryName(userMapper);
    Integer count1 = zbUserService.query101Count(userId);
    Integer count2 = zbUserService.query201Count(userId);
    Integer count3 = zbUserService.query301Count(userId);
    Integer count4 = zbUserService.query401Count(userId);



    ZbUserIndexVo zbUserIndexVo = new ZbUserIndexVo(count1, count2, count3, count4);
    ZbUserDataVo zbUserDataVo = new ZbUserDataVo(zbUserIndexVo);
    return BaseRespVo.success(zbUserDataVo);
}
}
